use crate::models::{Book, Books, BorrowItem};
use askama::Template;

#[derive(Template)]
#[template(path = "login.html")]
pub struct LoginTemplate {
    pub error: Option<String>,
}

#[derive(Template)]
#[template(path = "index.html")]
pub struct IndexTemplate {
    pub username: String,
    pub books: Vec<Book>,
    pub items: Vec<BorrowItem>,  // 借阅列表
    pub message: Option<String>, // <--- 新增这一行
}

#[derive(Template)]
#[template(path = "search.html")]
pub struct SearchTemplate {
    pub username: String,
    pub keyword: String,
    pub books: Vec<Books>,
}

#[derive(Template)]
#[template(path = "items_table.html")]
pub struct ItemsTableTemplate {
    pub items: Vec<BorrowItem>,
    pub message: Option<String>,
}
